// index.ts
// 获取应用实例
const app = getApp<IAppOption>()

const user = require("../../utils/user")
const navigate = require("../../utils/navigate")

Page({
  data: {
    username: '匿名用户',
    app_user_info: { name: "未认证" },
    wx_user_info: '',
  },
  // 事件处理函数
  bindViewTap() {
    wx.navigateTo({
      url: '../logs/logs',
    })
  },
  onLoad() {

  },
  onShow() {
    // @ts-ignore
    // get wx_user_info
    const wx_user_info = wx.getStorageSync("wx_user_info");
    if (wx_user_info === "") {
      navigate.get_wx_user_info();
    } else {
      this.setData({
        "wx_user_info": wx_user_info
      })
    }

    // get app_user_info
    user.user_log_in(this);
  },

  goto_real_name_auth_page() {
    wx.navigateTo({ url: "/pages/real_name_auth/real_name_auth" });;
  },
  goto_tele_auth_page() {
    wx.navigateTo({ url: "/pages/tele_auth/tele_auth" });;
  },
  goto_self_check_page() {
    wx.navigateTo({ url: "/pages/self_check/self_check" });;
  },
  goto_result_query_page() {
    wx.navigateTo({ url: "/pages/result_query/result_query" });;
  },
  goto_order_check_page() {
    wx.navigateTo({ url: "/pages/order_check/order_check" });;
  },
  goto_order_check_query_page() {
    wx.navigateTo({ url: "/pages/order_check_query/order_check_query" });;
  },
})
